using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Acms.WebControls
{
    [PersistChildren(true)]
    [ParseChildren(false)]
    [ToolboxData("<{0}:MenuBox runat=server></{0}:MenuBox>")]
    [Designer(typeof(MenuBoxDesigner))]
    public class MenuBox : WebControl
    {
        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "MenuBox");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Top");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Middle");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            RenderChildren(writer);
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Bottom");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
    }

    public class MenuBoxDesigner : ContainerControlDesigner
    {
        public override string FrameCaption
        {
            get{return "Acms Menu Box";}
        }

        private Style _Style;
        public override Style FrameStyle
        {
            get
            {
                if (_Style == null)
                {
                    _Style = new Style();
                    _Style.Width = Unit.Percentage(90);
                    _Style.Font.Name = "Verdana";
                    _Style.Font.Size = new FontUnit("Small");
                    _Style.BackColor = Color.LightGray;
                    _Style.ForeColor = Color.Black;
                }
                return _Style;
            }
        }
    }
}
